<?php
	//效验excel数据
	public function excel_check($totalcolumns,$totalrows,$objPHPExcel){
		// $order_no		= $objPHPExcel->getActiveSheet()->getCell("A".$i)->getValue();//订单编号
		$data=array();
		for($j=1;$j<=$totalrows;$j++){
			for($i=0;$i<$totalcolumns;$i++){
				if($totalcolumns<26){
					$columns=chr(65+$i).$j;
				}else{
					$current=chr(65+$i%26);
					$currenthead=chr(ceil($totalcolumns/26)+64);
					$columns=$currenthead.$current.$j;
				}
				$currentcolumns=$objPHPExcel->getActiveSheet()->getCell($columns)->getValue();
				if(is_object($currentcolumns)){
					$currentcolumns=$currentcolumns->__toString();
				}
				$data[$j][$current]=trim($currentcolumns);
			}
		}
		
		// dump($data);
		return $data;
	}
	public function upload_excel($_FILES){
		if(!empty($_FILES)){
			$config = array(
				'maxSize'    =>    3145728,    
				'savePath'   =>    '/Import/',
				'saveName'   =>    array('uniqid',''),    
				'exts'       =>    array('xlsx', 'xls'),    
				'autoSub'    =>    true,
				'subName'    =>    array('date','Ymd'),);
			$upload = new \Think\Upload($config);// 实例化上传类
			$info   =   $upload->upload();
			if(!$info) {// 上传错误提示错误信息      
				$return['status']=0;
				$return['message']=$upload->getError();
				$this->ajaxReturn($return);    
			}
			return $info;
		}else{
			$return['status']=0;
			$return['message']="请选择上传的文件!";
			$this->ajaxReturn($return);
		}
	}
